<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/struct_info.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
<script type="text/javascript" src="${staticServer}/common/uploadify/jquery.uploadify.js"></script>
<script type="text/javascript" src="${staticServer}/js/web/uploadImg.js?1.5"></script>

<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/datepicker.js"></script>

<style>
#SWFUpload_0{
	margin-top: 70px;
    margin-left: -30px;
}
#SWFUpload_1{
	margin-top: 70px;
    margin-left: -30px;
}
</style>
<script>
var contextPath='${contextPath}';
var _contextPath = '${staticServer}';

$(function(){
	$("#type").val("<#if demand??>${demand.type}</#if>");
	$("#grade").val("<#if demand??>${demand.grade}</#if>");
	$("#fz_username").val("<#if demand??>${demand.fz_username}</#if>");
	$("#kf_username").val("<#if demand??>${demand.kf_username}</#if>");
	$("#hz_username").val("<#if demand??>${demand.hz_username}</#if>");
	$("#state").val("<#if demand??>${demand.state}</#if>");
	
	var state = "<#if demand??>${demand.state}</#if>";
	if(state=="3"){
		$("#one").show();
	}else{
		$("#one").hide();
	}
	
	$("#state").change(function(){
		var state = $("#state").val();
		if(state=="3"){
			$("#one").show();
		}else{
			$("#one").hide();
		}
	});
});

var addDemand = function(){
	var id = $("#id").val();
	var title = $("#titles").val();
	var type = $("#type").val();
	var grade = $("#grade").val();
	var fz_username = $("#fz_username").val();
	var kf_username = $("#kf_username").val();
	var hz_username = $("#hz_username").val();
	
	var content = $("#content").val();
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	var img_url = $("#all_words").val();
	var data_url = $("#all_words4").val();
	
	var state = $("#state").val();
	var com_date = $("#com_date").val();
	
	if(type==""){
		infopad.err("请选择开发类型!");
		return;
	}
	if(grade==""){
		infopad.err("请选择需求等级!");
		return;
	}
	if(state==""){
		infopad.err("请选择开发状态!");
		return;
	}else{
		if(state=="3"){
			$("#one").show();
			if(com_date==""){
				infopad.err("请选择完成时间!");
				return;
			}
		}else{
			$("#one").hide();
		}
	}
	
	
	
	$.post("${contextPath}/index/add_demand.json", {
			"id":id,
			"title":title,
			"type":type,
			"grade":grade,
			"fz_username":fz_username,
			"kf_username":kf_username,
			"hz_username":hz_username,
			"content":content,
			"startTime":startTime,
			"endTime":endTime,
			"img_url":img_url,
			"data_url":data_url,
			"state":state,
			"com_date":com_date
		}, function(ms) {
		    var msg = ms.msg;
		    if(msg!=null && msg=="1"){
				infopad.msg("操作成功！");
				window.location.href="${contextPath}/index/demandList.htm";
		    }else{
		    	infopad.err("操作失败，请联系管理员！");
		    }
			
	});
};

</script>
</head>
<input type="hidden" id="id" value="<#if demand??>${demand.id}</#if>">
<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>组织架构</li>
			<li>&gt;</li>
			<li class="current">title</li>
		</ul>
	</div>

	<div id="container">
		<div id="title">添加项目需求</div>
		<table id="infotable">
			
			<tr>
				<th>需求名称:</th>
				<td>
					<input type="text" id="titles" size="50" value="<#if demand??>${demand.title}</#if>">
				</td>
			</tr>
			
			<tr>
				<th>开发类型:</th>
				<td>
					<select id="type">
						<option value="">请选择开发类型</option>
						<option value="1">web（OA办公系统）</option>
						<option value="2">前端（官网和页面设计）</option>
						<option value="3">IOS（苹果app开发）</option>
						<option value="4">web（训练系统）</option>
					</select>
				</td>
			</tr>
			
			<tr>
				<th>需求等级:</th>
				<td>
					<select id="grade">
						<option value="">请选择需求等级</option>
						<option value="1">A</option>
						<option value="2">B</option>
						<option value="3">C</option>
						<option value="4">无</option>
					</select>
				</td>
			</tr>
			
			<tr>
				<th>开发时间:</th>
				<td>
					<input type="text" id="startTime" placeholder="开始时间" value="<#if demand??>${demand.startTime}</#if>" rel="DATE::Y-m-d" value="" size="14" maxlength="15" readonly="readonly" class="DatePicker_Icon">
					<input type="text" id="endTime" placeholder="结束时间" value="<#if demand??>${demand.endTime}</#if>" rel="DATE::Y-m-d" value="" size="14" maxlength="15" readonly="readonly" class="DatePicker_Icon">
				</td>
			</tr>
			
			<tr>
				<th>需求内容:</th>
				<td>
					<textArea id="content" style="width:500px;height:150px;"><#if demand??>${demand.content}</#if></textArea>
				</td>
			</tr>
			
			<tr>
				<th>需求相关图片:</th>
				<td>
					<ul class="imglist">
					<div id="images" style="float: left;">
						<#if demand?? && demand.img_url?? && demand.img_url!="">
							<#list demand.img_url?split(",") as imgurl>
								<#if imgurl_index !=0>
								<li style="float:left;list-style-type: none;line-height:180px;*font-size:157px;"><img rel="800:485" width="180" height="109.125" src="http://www.yueqiao.org${imgurl}"></li>
								</#if>
							</#list>
						</#if>
					</div>
						
					<a class="file_box" style="list-style-type: none;float: left;display: block; width:180px; height:180px; overflow: hidden; border: 1px solid #EBEBEB; background: none repeat scroll 0 0 #F3F3F3; color: #999999; cursor: pointer; text-align: center; margin-left:10px; ">
                    <em style="background:url(${staticServer}/img/add_newpic.png) 0 0; display: inline-block; width:180px; height:180px; overflow: hidden;line-height: 20em; vertical-align: middle;">
                    <input type="file" id="upload" style="display: block;width:180px; height:180px;opacity: 0; filter:alpha(opacity=0); "></em>
                    </a>
                    <label class="zt_widthlabel" style=" font-size:9px; float:left; visibility:hidden;">文件：</label>
                    <input type="text" id="all_words" style=" width:100px; height:10px; float:left;visibility:hidden;" class="input w180" value="<#if demand??>${demand.img_url}</#if>">
					</ul>
				</td>
			</tr>
			
			<tr>
				<th>需求相关文件:</th>
				<td>
					<ul class="imglist">
					<div id="images4" style="float: left;">
						<#if demand?? && demand.data_url?? && demand.data_url!="">
							<#list demand.data_url?split(",") as dataurl>
								<#if dataurl_index !=0>
								<li style="float:left;list-style-type: none;line-height:180px;*font-size:157px;"><a href="http://www.yueqiao.org${dataurl}">文件下载</a></li>
								</#if>
							</#list>
						</#if>
					</div>
						
					<a class="file_box" style="list-style-type: none;float: left;display: block; width:180px; height:180px; overflow: hidden; border: 1px solid #EBEBEB; background: none repeat scroll 0 0 #F3F3F3; color: #999999; cursor: pointer; text-align: center; margin-left:10px; ">
                    <em style="background:url(${staticServer}/img/add_newpic.png) 0 0; display: inline-block; width:180px; height:180px; overflow: hidden;line-height: 20em; vertical-align: middle;">
                    <input type="file" id="upload4" style="display: block;width:180px; height:180px;opacity: 0; filter:alpha(opacity=0); "></em>
                    </a>
                    <label class="zt_widthlabel" style=" font-size:9px; float:left; visibility:hidden;">文件：</label>
                    <input type="text" id="all_words4" style=" width:100px; height:10px; float:left;visibility:hidden;" class="input w180" value="<#if demand??>${demand.data_url}</#if>">
					<input value="" type="hidden" id="oname" >
					</ul>
				</td>
			</tr>
			
			<tr>
				<th>开发老师:</th>
				<td>
					<select id="kf_username">
					<#if list??>
						<option value="">请选择开发老师</option>
						<#list list as list>
							<option value="${list.username}">${list.nickname}(${list.departments}-${list.job})</option>
						</#list>
						<option value="wuyue">吴悦(设计部-前端设）)</option>
					</#if>
					</select>
					<select id="hz_username">
					<#if list??>
						<option value="">请选择合作老师（一般是前端或美工）</option>
						<#list list as list>
							<option value="${list.username}">${list.nickname}(${list.departments}-${list.job})</option>
						</#list>
						<option value="wuyue">吴悦(设计部-前端设）)</option>
					</#if>
					</select>
				</td>
			</tr>
			
			
			<tr>
				<th>跟进老师:</th>
				<td>
					<select id="fz_username">
						<option value="">请选择跟进老师</option>
						<option value="yuanjing">袁晶（财务和绩效）</option>
						<option value="guobin">郭斌（网推）</option>
						<option value="liulan">刘岚（行政和采购）</option>
						<option value="xumengli">许梦黎（数据后台）</option>
						<option value="zhangxiaoqian">张晓倩（行政财务）</option>
						<option value="wangjiawei">王佳伟（绩效统计）</option>
						<option value="wangpei">王佩（行政财务）</option>
						<option value="wangping">王萍（督导）</option>
						<option value="yexiling">叶喜玲（人事专员）</option>
						<option value="hongyan">洪燕（薪酬绩效专员）</option>
						<option value="lijie">李杰（员工关系）</option>
						<option value="liliping">李利平（教务部）</option>
						<option value="zhanglong">张龙老师（总部管理）</option>
					</select>
				</td>
			</tr>
			
			<tr>
				<th>开发状态:</th>
				<td>
					<select id="state">
						<option value="">请选择开发状态</option>
						<option value="1">待开发</option>
						<option value="2">正在开发</option>
						<option value="3">已完成</option>
					</select>
				</td>
			</tr>
			
			<tr id="one" style="display:none">
				<th>完成时间:</th>
				<td>
					<input type="text" id="com_date" placeholder="完成时间" value="<#if demand??>${demand.com_date}</#if>" rel="DATE::Y-m-d" value="" size="14" maxlength="15" readonly="readonly" class="DatePicker_Icon">
				</td>
			</tr>
			
		</table>
		<div id="controlbar">
			<input type="button" class="submit" onclick="addDemand()" value="  保  存  " />
		</div>
	</div>
	
</body>
</html>